package call_reference

//A数组{1,2,3}里面所有的值依次加上B数组{4,5,6}里面所有的值 只留下相加后值大于5数字
fun main(args: Array<String>) {
    val max = getMax1(::add, ::filterMain)
    val list1 = listOf(1,2,3)
    val list2 = listOf(4,5,6)
    println(list1.filter { x->max(x,list2[0])})
}

fun add(a:Int,b:Int) = a+b
fun filterMain(x:Int) = x>5

fun<A,B,C,D> getMax1(f:(A,B)->C,g:(C)->D):(A,B)->D{
    return {a,b->g(f(a,b))}
}